3.252 \(\int \frac{\cos (c+d x)}{a \sin (c+d x)+b \tan (c+d x)} \, dx\)

Optimal. Leaf size=80 \[ -\frac{b^2 \log (a \cos (c+d x)+b)}{a d \left (a^2-b^2\right )}+\frac{\log (1-\cos (c+d x))}{2 d (a+b)}+\frac{\log (\cos (c+d x)+1)}{2 d (a-b)} \]

[Out]

Log[1 - Cos[c + d*x]]/(2*(a + b)*d) + Log[1 + Cos[c + d*x]]/(2*(a - b)*d) - (b^2*Log[b + a*Cos[c + d*x]])/(a*(
a^2 - b^2)*d)

________________________________________________________________________________________

Rubi [A]  time = 0.236899, antiderivative size = 80, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.154, Rules used = {4397, 2837, 12, 1629} \[ -\frac{b^2 \log (a \cos (c+d x)+b)}{a d \left (a^2-b^2\right )}+\frac{\log (1-\cos (c+d x))}{2 d (a+b)}+\frac{\log (\cos (c+d x)+1)}{2 d (a-b)} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]/(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

Log[1 - Cos[c + d*x]]/(2*(a + b)*d) + Log[1 + Cos[c + d*x]]/(2*(a - b)*d) - (b^2*Log[b + a*Cos[c + d*x]])/(a*(
a^2 - b^2)*d)

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 2837

Int[cos[(e_.) + (f_.)*(x_)]^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)
*(x_)])^(n_.), x_Symbol] :> Dist[1/(b^p*f), Subst[Int[(a + x)^m*(c + (d*x)/b)^n*(b^2 - x^2)^((p - 1)/2), x], x
, b*Sin[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && IntegerQ[(p - 1)/2] && NeQ[a^2 - b^2, 0]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 1629

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*
Pq*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps

\begin{align*} \int \frac{\cos (c+d x)}{a \sin (c+d x)+b \tan (c+d x)} \, dx &=\int \frac{\cos (c+d x) \cot (c+d x)}{b+a \cos (c+d x)} \, dx\\ &=-\frac{a \operatorname{Subst}\left (\int \frac{x^2}{a^2 (b+x) \left (a^2-x^2\right )} \, dx,x,a \cos (c+d x)\right )}{d}\\ &=-\frac{\operatorname{Subst}\left (\int \frac{x^2}{(b+x) \left (a^2-x^2\right )} \, dx,x,a \cos (c+d x)\right )}{a d}\\ &=-\frac{\operatorname{Subst}\left (\int \left (\frac{a}{2 (a+b) (a-x)}-\frac{a}{2 (a-b) (a+x)}+\frac{b^2}{(a-b) (a+b) (b+x)}\right ) \, dx,x,a \cos (c+d x)\right )}{a d}\\ &=\frac{\log (1-\cos (c+d x))}{2 (a+b) d}+\frac{\log (1+\cos (c+d x))}{2 (a-b) d}-\frac{b^2 \log (b+a \cos (c+d x))}{a \left (a^2-b^2\right ) d}\\ \end{align*}

Mathematica [A]  time = 0.100196, size = 70, normalized size = 0.88 \[ \frac{b^2 (-\log (a \cos (c+d x)+b))+a (a-b) \log \left (\sin \left (\frac{1}{2} (c+d x)\right )\right )+a (a+b) \log \left (\cos \left (\frac{1}{2} (c+d x)\right )\right )}{a d (a-b) (a+b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]/(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

(a*(a + b)*Log[Cos[(c + d*x)/2]] - b^2*Log[b + a*Cos[c + d*x]] + a*(a - b)*Log[Sin[(c + d*x)/2]])/(a*(a - b)*(
a + b)*d)

________________________________________________________________________________________

Maple [A]  time = 0.101, size = 80, normalized size = 1. \begin{align*}{\frac{\ln \left ( \cos \left ( dx+c \right ) +1 \right ) }{d \left ( 2\,a-2\,b \right ) }}+{\frac{\ln \left ( -1+\cos \left ( dx+c \right ) \right ) }{d \left ( 2\,a+2\,b \right ) }}-{\frac{{b}^{2}\ln \left ( b+a\cos \left ( dx+c \right ) \right ) }{d \left ( a+b \right ) \left ( a-b \right ) a}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c)),x)

[Out]

1/d/(2*a-2*b)*ln(cos(d*x+c)+1)+1/d/(2*a+2*b)*ln(-1+cos(d*x+c))-1/d*b^2/(a+b)/(a-b)/a*ln(b+a*cos(d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.56268, size = 138, normalized size = 1.72 \begin{align*} -\frac{\frac{b^{2} \log \left (a + b - \frac{{\left (a - b\right )} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )}{a^{3} - a b^{2}} - \frac{\log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a + b} + \frac{\log \left (\frac{\sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + 1\right )}{a}}{d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

-(b^2*log(a + b - (a - b)*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)/(a^3 - a*b^2) - log(sin(d*x + c)/(cos(d*x + c)
+ 1))/(a + b) + log(sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + 1)/a)/d

________________________________________________________________________________________

Fricas [A]  time = 0.564225, size = 190, normalized size = 2.38 \begin{align*} -\frac{2 \, b^{2} \log \left (a \cos \left (d x + c\right ) + b\right ) -{\left (a^{2} + a b\right )} \log \left (\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) -{\left (a^{2} - a b\right )} \log \left (-\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right )}{2 \,{\left (a^{3} - a b^{2}\right )} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(2*b^2*log(a*cos(d*x + c) + b) - (a^2 + a*b)*log(1/2*cos(d*x + c) + 1/2) - (a^2 - a*b)*log(-1/2*cos(d*x +
 c) + 1/2))/((a^3 - a*b^2)*d)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\cos{\left (c + d x \right )}}{a \sin{\left (c + d x \right )} + b \tan{\left (c + d x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c)),x)

[Out]

Integral(cos(c + d*x)/(a*sin(c + d*x) + b*tan(c + d*x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.21627, size = 180, normalized size = 2.25 \begin{align*} -\frac{\frac{2 \, b^{2} \log \left ({\left | -a - b - \frac{a{\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac{b{\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} \right |}\right )}{a^{3} - a b^{2}} - \frac{\log \left (\frac{{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right )}{a + b} + \frac{2 \, \log \left ({\left | -\frac{\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1 \right |}\right )}{a}}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(2*b^2*log(abs(-a - b - a*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + b*(cos(d*x + c) - 1)/(cos(d*x + c) + 1)
))/(a^3 - a*b^2) - log(abs(-cos(d*x + c) + 1)/abs(cos(d*x + c) + 1))/(a + b) + 2*log(abs(-(cos(d*x + c) - 1)/(
cos(d*x + c) + 1) + 1))/a)/d